app.get("/fileList",async (req,res)=>{
    let {page=1,num=10,d=".",order,f=null,keyword=null}=req.params;
    if(!order){
        order="";
    }
    let queryObj={
        page,num,d,order
    }
    if(f){
        queryObj.f=f;
    }
    if(keyword){
        queryObj.keyword=keyword;
    }
    let r= await M.request.get("/t_file/list",queryObj)
    res.send(r);
});


app.get("/addDir",async (req,res)=>{
    let {
        d,
        p,
        n,
        f,
        s
    }=req.params;
    let r=await M.request.post("/t_file/add_dir",{
        d,
        p,
        n,
        f,
        s
    });
    res.send(r);
})





app.get("/upload",async (req,res)=>{
    let formData=req.params;
    fetch('/t_file/upload', {
        method: 'post',
        body: formData
    }).then(response => response.json())
        .catch(error => console.error('Error:', error))
        .then(response => res.send(response));
})